import { createRouter, createWebHistory, } from 'vue-router'
const routerHistory = createWebHistory()
interface Person {
    keepAlive: boolean
}
interface roueType {
   readonly path: string
    name?: string
    dirName?:string
    meta?:any
    redirect?:string
}
const routerOptions:Array<roueType> = [
    { path:'/',redirect:'/home'},
    { path: '/home',name: 'Home',dirName:'views',meta:{keepAlive: true}},
    { path: '/about',name: 'About',dirName:'views',meta:{keepAlive: true}},
    { path: '/login',name: 'Login',dirName:'views',meta:{keepAlive: false}},
    { path: '/register',name: 'Register',dirName:'components/register',meta:{keepAlive: true}},
]
const routes = routerOptions.map( route=>{
    return {
        ...route,
        component: ()=> import(/*webpackChunkName:[request]*/`@/${route.dirName}/${route.name}.vue`)
    }
})
const router = createRouter({
    history: routerHistory,
    routes,
})
export default router
